package com.gzs.learn.payment.inf.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
public enum OrderFromEnum {
	HOTEL(101, "酒店"),

	AIR_TICKET(201, "机票"),

	TRAFFIC(301, "交通"),

	DIGITAL(401, "数码"),

	ADS(501, "广告"),

	;

	private static final Map<Integer, OrderFromEnum> HOLDER_MAP = new HashMap<>();
	static {
		for (OrderFromEnum e : values()) {
			HOLDER_MAP.put(e.getCode(), e);
		}
	}

	private final int code;
	private final String desc;

	OrderFromEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public static OrderFromEnum convert(int code) {
		return HOLDER_MAP.get(code);
	}
}
